<?php

use app\assets\ApiAsset;
use app\assets\LayerAsset;
use app\assets\TableAsset;
use app\widgets\LinkPager;
use app\widgets\ManagerTableOp;
use yii\helpers\Html;
use app\models\KeyMap;
use dosamigos\datepicker\DatePicker;
/**
 * @var $this yii\web\View
 * @var $profitList app\models\AgentProfit[]
 * @var $pagination yii\data\Pagination
 */

ApiAsset::register($this);
LayerAsset::register($this);
TableAsset::register($this);

$this->title = '视频会员卡密列表';
$this->params['breadcrumbs'][] = '财务管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php echo Html::beginForm('?', 'get', ['class'=>'form-inline']);?>
<div class="form-group">
    <label for="search_key_status" class="sr-only">状态</label>
    <?php echo Html::dropDownList('search_key_status', Yii::$app->request->get('search_key_status'), KeyMap::getValues('key_status'), ['id' => 'search_key_status', 'class' => 'form-control', 'prompt' => '状态']);?>
</div>
<div class="form-group">
    <label for="search_iccid" class="sr-only">ICCID</label>
    <?php echo Html::textInput('search_iccid', Yii::$app->request->get('search_iccid'), ['id'=>'search_iccid', 'class'=>'form-control', 'placeholder'=>'ICCID', 'style' => 'min-width:180px;']);?>
</div>
<div class="form-group">
    <button class="btn btn-primary btn-sm">搜索</button>
</div>
<?php echo Html::endForm();?>
<table class="table table-striped table-bordered table-hover">
    <thead>
    <tr>
        <th class="center">
            <label class="pos-rel">
                <input type="checkbox" class="ace" />
                <span class="lbl">编号</span>
            </label>
        </th>
        <th class="center">ICCID</th>
        <th class="center">卡密</th>
        <th class="center">状态</th>
        <th class="center">创建时间</th>
        <th class="center">领取时间</th>
    </tr>
    </thead>

    <tbody>
    <?php foreach ($keyList as $key) {?>
        <tr>
            <td class="center"><label class="pos-rel"><input type="checkbox" class="ace" value="<?php echo $key->id;?>" /><span class="lbl"><?php echo $key->id;?></span></label></td>
            <td class="center"><?php echo empty($key->iccid) ? '----' : Html::encode($key->iccid);?></td>
            <td class="center"><?php echo $key->secret_key;?></td>
            <td class="center"><?php echo KeyMap::getValue('key_status',$key->status);?></td>
            <td class="center"><?php echo Yii::$app->formatter->asDatetime($key->create_time);?></td> 
            <td class="center"><?php echo empty($key->execute_time) ? '------' : Yii::$app->formatter->asDatetime($key->execute_time);?></td>
        </tr>
    <?php }?>
    </tbody>
</table>
<?php echo LinkPager::widget(['pagination' => $pagination]);?>
